import {
  launchChrome,
  removeWebdriver,
  setCookie,
  writeCookie,
  randomNumOneToFive,
  sleep
} from './common'

class DaMai {
  browser: any
  constructor() {
    this.browser = undefined
  }
  // 创建puppeteer页面
  async createPage() {
    try {
      const browser = await launchChrome()
      this.browser = browser
    } catch (e) {
      console.log(88888888, e)
    }

    // await setCookie(page, cookieName)
  }

  async login(cookieName: string) {
    const page = await this.browser.newPage()
    removeWebdriver(page)
    await page.goto('https://passport.damai.cn/login')
  }
}
// const chrome = await puppeteer.launch({
//   executablePath:
//     process.env.NODE_ENV === 'development'
//       ? path?.join(app.getAppPath(), 'bundled\\chrome\\win64-1056772\\chrome-win\\chrome.exe')
//       : path?.join(app.getAppPath(), '../', 'chrome\\win64-1056772\\chrome-win\\chrome.exe'),
//   defaultViewport: null,
//   ignoreDefaultArgs: true,
//   args: args
// })
export const daMai = new DaMai()
